package com.cy.yonghe.controller;

import com.cy.yonghe.model.Door;
import com.cy.yonghe.service.IDoorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/door")
public class DoorController {

    @Autowired
    IDoorService doorService;

    // http://localhost:8080/door/list
    @RequestMapping("/list")
    public String list(Model model) {
        List<Door> doors = doorService.list();
        model.addAttribute("doors", doors);
        return "door/list";
    }

}
